<link href="<@sp.static/>/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="<@sp.static/>/assets/css/style.min.css" rel="stylesheet"/>
<link href="<@sp.static/>/assets/plugins/datatables/css/data-table.css" rel="stylesheet"/>
<div style="overflow: auto; height: 450px; position: relative; margin: 8px;">
    <div class="panel panel-inverse" data-sortable-id="form-stuff-5">
        <div class="panel-heading">
            <h4 class="panel-title">核销用户卡券</h4>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" id="memberForm" name="memberForm" action="" method="post">
                <div class="form-group m-l-10">
                    <div class="col-md-9">
                        <label>用户手机号：${uvCounponInfo.mobile}</label>
                        <input type="hidden" id="id"  name="id" placeholder="用户卡券id" value="${uvCounponInfo.id}">
                    </div>
                </div>

                <div class="form-group m-l-10">
                    <div class="col-md-9">
                        <label>卡券名称：${uvCounponInfo.couponName}</label>
                    </div>
                </div>

                <div class="form-group m-l-10">
                    <select class="form-control" style="width: 35%" name="storeId" id="storeId">
                        <option value="">使用店铺</option>
                        <#if storeList?has_content && storeList?exists>
                        <#list storeList as pf>
                        <option value="${pf.id}">${pf.name}</option>
                    </#list>
                </#if>
                </select>
        </div>
        <div class="form-group">
            <label class="col-md-3 control-label"></label>
            <div class="col-md-9">
                <button type="button" id="submitButton" class="btn btn-sm btn-success">确认核销</button>
            </div>
        </div>
        </form>
     </div>
    </div>
</div>
<script language="JavaScript">
    $(function () {
        $('#submitButton').click(function () {
            $('#memberForm').submit();
        });

        $('#memberForm').validate({
            rules: {
                storeId: {
                    required:true
                }

            },
            messages: {
                storeId: {
                    required : "必须选择一个店铺"
                }
            },
            errorPlacement: function (error, element) {
                error.appendTo(element.parent());
            },
            submitHandler: function () {
                var id = $('#id').val();
                var storeId = $('#storeId').val();
                postDataByForm('${rc.contextPath}/backend/member/stringconfirmerUserCoupon?id='+id+'&storeId='+storeId, 'displayArea', 'memberForm');
                parent.layer.closeAll();
            }
        })
    })
</script>